package com.clkj.xiuzheng.dao.shangcheng;

import com.clkj.xiuzheng.pojo.shangcheng.OrderInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;

import java.util.List;

/**
 * @author yawang
 * @create 2024/05/10 10:41:52
 **/
@Repository
public interface ScOrderInfoMapper  extends Mapper<OrderInfo>, MySqlMapper<OrderInfo> {

    @Select("select a.*,b.product_name,b.product_image,c.format_name,c.product_score from t_xz_orderInfo a " +
            "left join t_xz_product b on a.product_id = b.product_id " +
            "left join t_xz_productFormat c on a.format_id = c.format_id " +
            "where a.order_number = #{orderNum} ")
    List<OrderInfo> listOrderInfoByOrderNum(@Param("orderNum") String orderNum);


    @Select("select i.*,o.customer_name,o.customer_address,o.customer_tel,o.order_status,o.order_date as orderTime,p.product_name,f.format_name,o.send_company,o.send_comName,o.send_order from t_xz_orderInfo i left join t_xz_order o on i.order_number = o.order_number\n" +
            " left join t_xz_product p on i.product_id = p.product_id LEFT JOIN  t_xz_productFormat f on i.format_id = f.format_id " +
            " where o.order_id in (${ids})")
    List<OrderInfo> selectOrderInfoByIds(@Param("ids") String ids);
}
